<?php
include_once 'config.php';
function add_user($username,$password,$DB_NAME){
	$db=new SQLiteDatabase($DB_NAME);
	$real_name= sqlite_escape_string($username);
	$real_passord = sqlite_escape_string($password);
	$md5_password = md5($real_passord);
	$db->query("BEGIN;
	insert into users (username,password) values ('$real_name','$md5_password');
	COMMIT;");
}
if(is_null($_POST["myusername"])){
	?>
<table width="300" border="0" align="center" cellpadding="0"
	cellspacing="1" bgcolor="#CCCCCC">
	<tr>
		<td>
			<form name="form1" method="post" action="add-user.php">
				<table width="100%" border="0" cellpadding="3" cellspacing="1"
					bgcolor="#FFFFFF">
					<tr>
						<td colspan="3"><strong>Member Login </strong>
						</td>
					</tr>
					<tr>
						<td width="78">Username</td>
						<td width="6">:</td>
						<td width="294"><input name="myusername" type="text"
							id="myusername">
						</td>
					</tr>
					<tr>
						<td>Password</td>
						<td>:</td>
						<td><input name="mypassword" type="password" id="mypassword">
						</td>
					</tr>
					<tr>
						<td>Repeat Password</td>
						<td>:</td>
						<td><input name="remypassword" type="password" id="mypassword">
						</td>
					</tr>
					<tr>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td><input type="submit" name="Submit" value="Login">
						</td>
					</tr>
				</table>
			</form></td>

	</tr>
</table>
	<?php
}else{
	add_user($_POST["myusername"],$_POST["mypassword"],$DB_NAME);
}
?>